fix bug in registration