fix error in dragging, variable was being set too soon