avoid overlapping read and write