Fix write_raw_image to work with mmc