corrected undo part - also for new lines (character at position 0)