fix if then else block