finetuning function error corrected