fixed bug introduced last commit, where condition was backwards