Fixed the factory for resources