Fixed getBestRatio method