Fix inversed conditions