Fixed dragging code