fix bug and get correct result