Fixed serialization potential crash when a model can't be serialized.