applied patch 6 from http://www.lua.org/bugs.html