fixed problems with streams