halt on build error and other fixes

This fixes one issue in #18 and #20.