Fixed perma-looping bug