Code: Misc. fixes.
Merge pull request #1405 from am11/master

Code: Misc. fixes