Added debug argument for metadata factory