Added build.lua and fixed bugs