added null check to read operation