fixing issues with events not triggering properly