fix bug where it was not replacing correctly for multipart

* make sure we respect excluded path as well