before-hooks router fix