change the location of if clause.