loop end fixed