fixing bug in model