fixed bugs with math model