bug and test fixes
Merge pull request #1 from Chipsoid/master

bug and test fixes