Fixed some edge case bugs with if statements that would apear when nesting more than 2 ifs with an else statement.