Modify the mechanism that files copy to lua-empty-test and lua-template and fix some bugs