[WIP] Fix crash in clearCachedCatalogs