Fixed a bug in reduction logic