Fix gcc serialization code, and improve binary serialization.