possible endless loop fixed