fix ModelType to deal with json conversion, and add test