Corrected error when the integration time limit caused a single integration to be left at the end of the gains calculation