Restore positions of cursors after inserting debug statements

Restore positions of cursors after inserting debug statements so that the cursor is not always set at the beginning of the file (issue #2).