Fixup read_file implementation.

And fixed the tests.