InstanceManager: Add getNumInstances method