Fix some bugs with the build process so it now actually works