Fix bug in dragging action