Replaced path.basename with path.dirname to fix issue #3.