add before hook