Small fixes

Some small fixes I've stumbled upon while doing the next pull request.