Fixed bug in registration process