Fixed bug in calculation of tuning