Be very careful with this - I already fixed a bug when you inappropriately changed acknowledge logic this way.
Ask a question - what will happen if this code will be executed in parallel, what will happen if one reply comes after another while you play with this flag and so on...