fixed pad_factor residual bug
(#389)