Fixes for #82

The problems described in #82 turned out to be two distinct issues, but they're both relatively simple fixes for problems that affect the same part of setup, so I'm keeping them together if no one objects. 

See the commit messages for details on each fix.