fixed a bug in cleanCooperative function