correct get_metric_val function