update the code and found that algorithm have some preferance choosen problem