refactor luamgr