error check in register()