fix the register bug