Fix a bug in cleanAckedMessages