Fix minor issues

These commits fix two minor issues:

* Incorrectly constructing a filename
* Ignoring getcwd's return status