check for proper inheritance before attaching event listener class
add class_exists check also
Merge pull request #1543 from craigh/listenersFix

check for proper inheritance before attaching event listener class