changing error condition to when there is actually an error