better solution for duplicate events bug