fix some bugs to get the models working