safety check in the reading method added