Testing stream end issue