Some small bugfixes

I found these while experimenting with some bigger changes I am planning. I guess I should get the uncontroversial stuff out of the way first :)