Fix segmentation fault caused by overlooping
[Lua] Add bot.reguser:apply_flags()