modify registerInstances method.