Two fixes for the problems that I had on OSX (with Lua-5.1)

Hi Leo,

Please review the commits and pulled them. Please also feel free to edit them if you need.

Best,
Soonho