fixing refoctor bug