Fix bug in aggregate metrics