fix some serialization bugs