Fix some issues related to factorization