Fix issue with writeFlashBuffer