Return -EIO instead of -1 in case of error