simplify metadata fetch logic