fix leaking event listener