add before handler