tests and bug fix for reverse stream