Fixed looping behavior