changed the execution order of the before callback