fix bug with path rewrites where source is 'deeper' in directory tree than
destination (fix #264)