Various fixes

Hi!

Here is various fixes. I didn't bother to make a pull request for each of them since they are very small.