Fixed bug in registration