Improved lua 5.2 and 5.3 support