convert to luajit and localize some library functions