add before_restart hook