Fix bug causing massive slowdown after a few events