Fix cusor position when on document cleanup