Fix issue which can lead to corrupted data when the write happens not fast enough