Fix bug at last character of file.