Update file reader

Avoid null access
Header serialization
Don't use hexdump as token.