Fixed "not function" error when no listener exists.