Fix out of order writes. This is kind of a hack and I need to find a better way