fixed typo and logic error (== -> !=)