fixed bugs, now is correct.