Moves UNUSED to before cleanup check. Fixes stream entry cleanup.