various fixes
Merge pull request #316 from jpecht/master

various fixes