fixed some bugs in models