Fix logic in ratio test