fixed bug caused by the presence of old event listeners