np.vectorize doesn't always work here, do it explicitly