fix reversed condition