This is the version like it was send for mainline inclusion. SVN-Revision: 34988
This is based on the patch by Peter Wagner. SVN-Revision: 34252