bug fix and added the sub model trick