Fixed issue where pathRoot wasn't being considered.
Added test.
Merge pull request #77 from clayzermk1/rewrite

Fixed issue where pathRoot wasn't being considered