fixes for #1078

fixes mentioned in comments in #1078

the most controversial bit in here is changing the build dir name
(note that we changed the name in 1.3.1 due to security issues, and had no fallout from that)