bug fix for #15 and #26
Merge pull request #27 from scorpionmanace/master

bug fix for #15 and #26. Thanks, I added 3pts/issue.