improved replace.js
adding fakeDir