Working version for lua 5.2