adding better model tests. fixed some bugs