fix accidental if condition repetition