Add pause function to onBeforeAction call