fixing maxListeners, and writing tests