fix code.

remove duplicate block of if statement.