fix a bug for pi