fixes error message when file is not writable