Fix 'if' ordering