Fix a sizeof error in RDebug.reg_sync(). By rewriting the whole function.