Various small fixes

Oh, dammit. Thanks for spotting this!