util: misc code style.
core: introduce _normalizeStream to abstract the compatability logic a bit.