adding endstream