Return 0 instead of -1 if the stream is done