bug fixing for tuning