Some fixes in serialization / deserialization of plans.