Bugfixes from bleeding back-ported to unstable.