Fix logical issue
Merge pull request #152 from Gray-Wind/master

Fix logical issue