fixed issue of multiple insertions due to multiple event handlers