Fixed silly loop bug