Corrected logic in if statement (fixes #4)