Fixed a bug in registration