Add guard against reading past end of sub stream