Do something just before a callback is executed