fixed error event firing multiple times