Improved tests for user registration. Fixed a bug they exposed.