lots of bug fixes due to the recent model changes