fix events overflow at the end