Fix handling of factors.