Fix cleaning of metadata in new version