avoid np.pad for old numpy