Fixed bug in estimating pixel gains for motion correction.