Fixing bug in factor.