Fixed bug in math model