#879 write contents to file using correct attribute