fix padding problem with J = log(size(x))