directory replacement bug fixed