deserialization now returns the derived type