Fixed in-file reader function.
End-of-file was handled incorrectly. Fixes #9.