Fix Container.getMetadata() such that it does not use container state
Restore cached metadata in Container