Fixed dragging functions.

Fixed the Dragging Both function and Fixed some bugs.