GCC-4.7 fixes + LuaJIT compatibility

Signed-off-by: Vadim A. Misbakh-Soloviov <mva@mva.name>