Fixed the registration bugs