fixing infinite loop in metrics