Fixing bug in fitModel.R