Fixed the race condition w.r.t. read/write ops