tunning function bug fixed.