bug fixing concerning writeDistantFile when the path is unknown