fixed not unit test and refactor outputstream