Attempt to fix looping behaviour