fix if ends