Fixed some hanging ifs