Fixed two bugs when moving up a line in the buffer