Fixing a bug in registration

Thanks @bencentra (twitter: @thebencentra) for help and testing.