fix some bugs in models