Update main.lua

Even more bugs fixed