I had the same problem last year. Firstly get it glyco tested,I took mine to mercedes costing £80. Thankfully no contamination.
Then I took it to a gearbox specialist who rebuilt the TC and valve body,flushed the gearbox,replaced a solenoid and various seals...Problem solved. Wasn't cheap though.
Good luck