Fix input serialization bug