add before hooks