Merge pull request #1015 from am11/master

Misc. fixes