Added a check to see if the method exists when looping the

eventlisteners.