Position Overflow Bug Fix

A quick fix to make sure the drag function didn't write to the next
line when touching the border.

Also removed some debugging code