Merge pull request #3 from azureru/master

Fix the logic bug