Fix an IllegalStateException when retrieving metadata for the root container and a possible problem with the cache when reconnecting