resolves #335 fix bad variable name, add test for it
Merge pull request #336 from mojavelinux/basedir-tofile-crash

resolves #335 fix bad variable name, add test for it