fix metric calculation