Ensure callbacks are called in the right order