Fix #236 add beforeSave event