fixed bug with multiple event listeners