fix on the if then else condition