edit lua system, adding check function