Fix some errors.
Preparing to fix Factory