changed some table and index wrapper to avoid dublication of lua state traking