fixing events bug