Fix bugs in afterSave/afterDelete