fix a bug in register