fixing for luajit/th conventions