Fixed various bugs in multivariate factorization.