Fixed the inverted error check