Fixed the way metadata was being retrieved