Commits unrelated to the upcoming large PR.

OK, like I said before, I have a pretty large PR coming up in the coming days, but I have a few commits which are bugfixes and aren't connected to the rest of the commits in the upcoming PR. If you have time for these before my work is complete, great, otherwise I'll add on the large PR to this later on.