fixed some bugs in register part