Fixed inf loop