Fixes for 0.4.6

Cherry picked from master.

Enough for 0.4.6? Iirc, I saw at least one more spacing/margins issue, but it doesn't seem to be very disturbing. I'll spend my time with 0.5.x and go over the code before the 0.5.0 release.