fix a bug when removing first line in the document