Avoiding a strange character at the end of the file