handle serialization for program- and script-classes