Fix broken logic.
Merge pull request #416 from hean01/master

Fix broken logic.