Implemented reduction for regression.
Fixed a bug.