added detail of writing failure