fixed some Lua functions; updated tgdi