fixed several issues related to dragging, and resolved crashing.