Fix metric calculation