Fixed new bug in device registration code