Fix edge case when reading an empty file