Fix package file serialization to not corrupt things.