added missing stream_cast function, fixes pagekit/framework#291