infinity loop fixed