fix #11 (with bonus fix)
Merge pull request #12 from revily/master

fix #11 (with bonus fix)