added stopiteration flag to streamhandler