fix for ReferenceError: event is not defined