Use pack_data() in write_flash().

--BRJ