Fix incorrect exits on un-nested ifs