fixed the bug in best.R