Fixed an error in ObjectFactory