remaining inv deduction bug fix