fix leakage calculation