fix a wrong alorgrithm

fix a wrong alorgrithm