Fixed up build scripts. Also fixed critical bug.