Fix and add unit test
Merge pull request #46 from alicoding/unitTest

Fix and add unit test