An agricultural baler for producing rectangular bales, provided with a baling chamber and reciprocating plunger and a bale length control system for producing bales of substantially equal length, and with a bale-eject system for evacuating the last bales from the chamber at the end of a harvesting run. The baler according to the invention is provided with one or more sensors configured to detect the activation of said bale-eject system, and configured to automatically reset said bale-length control system, when said sensors detect said activation.