Fixed checkReg() and register()