fix: properly remove event listeners for memory leak prevention