Ensure state between before and after callbacks