Merge pull request #610 from am11/master

Misc. bug fixes