Properly remove listeners to avoid NPEs