fixing read atomicity bug