Minor fixes

See commit messages and comments... These are separate issues and not directly related, don't know why GitHub adds everything to a single pull request.