Fix some bugs
Merge pull request #2 from redhoodie/master

Fix some bugs