Fix minor bug in checking read return