Fix un/serialize bug