Deductions & credits

Taking this to a whole new level, I have a situation where my HSA card was misused on multiple occasions.  I deposited money back into my HSA account to offset this thinking it would all work out in the end.  Not so.  I now have two issues.  The Gross distribution in Box 1 of my 1099-SA includes all distributions (even the erroneous ones), and I have now exceeded the maximum allowable contribution.  I accounted for both the non-medical purchases and additional contributions in TurboTax, but I am getting taxed on both since my 'reimbursement' is seen as an excessive contribution.  Any thoughts on how to clear this up?