Improved create_model_from_dict and m.get_dict_from_model