fixed Issue #273

here is my suggestion.
there's still some problem. it doesn't handle path starting with '**' well, but the original code doesn't do well either.