fix stupid endless loop bug