Fixed mixed up exception-checking logic