Merge pull request #493 from themainfunction/master

A few misc bug fixes to make the build work properly