Fix return value check on read