Integration test for metrics + bug fix