Merge pull request #1121 from dorkster/fixes

Various fixes