fix for #29

This fixes the issue in #29, at least for the narrow use case outlined there.

A couple of things:

* No idea if this breaks Windows. 
* Happy to add a test if there's a test suite I'm just not seeing.