fix exception message when not a able to write to a directory