replace all # inside wd with ~. close #365