Fix "paste" and "last line" bugs