Fix a bug in registration view, write tests.