fix padding miscalculation, thanks JaeTea666, fixes #17571