fix reduce bugs