commit some old code, make work on lua 5.1