Remove duplicated `if` statement