fixed bug with "if else"