fixed bug with "if else" branches