Added a check for disabled around the event handler registration.