Fixed some issue with model genereation