add before save
add before update and fix bug before insert