fix some bugs about registration