fixed stream response assertion, code refactoring