Write file with stream, gm.write is buggy?