Fixed metric calculation error