make the code compatible with lua5.2.3