more small changes converting from ruby to lua