Fixed to use correct event names for different browsers