Fixed typo: inversed condition was used.