fix broken looping