reduce calls of p_get_metadata()