Fix a few minor bugs
Merge pull request #3211 from kevinkirkup/master

Fix a few minor bugs