fixed bugs from screwed-up commit
Merge pull request #4 from dym99/master

fixed bugs from screwed-up commit