fixed a few bugs in affManager