Error message doesn't seem to correspond to if condition.