fixing errors related to dragging events.