Benjamin Kramer and Joerg Sonnenberger for their input and fixes.
branch. This brings us very close to the 3.0 release, which is expected in a week or two. MFC after: 1 week