bug fixes
Merge pull request #947 from pennij/master

Bug fixes