Fixed bug in register() method.