Fixing bug in if evaluation and adding the correspondent tests to the bug