title: Latex chapter refrencing giving the last chapter last section reference
body: <p>I have a problem referencing a chapter. I used a label bellow each title however, it is not giving the right reference. I tried some fixes but it did not work (nameref, varioref, cleveref)</p>
  <p>my latex code is as follows</p>
  <pre><code>\documentclass[12pt,a4paper]{book}
  \usepackage[utf8]{inputenc}
  \usepackage[french,arabic,english]{babel}
  \usepackage[T1]{fontenc}
  \usepackage{amsmath}
  \usepackage{amsfonts}
  \usepackage{amssymb}
  \usepackage{graphicx}
  \graphicspath{{images/}}
  \usepackage{float}
  \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
  \usepackage{arabtex}
  \usepackage{multirow}
  \usepackage{threeparttable}
  \usepackage{utf8}
  \usepackage{longtable}
  \usepackage{url}
  \usepackage[colorinlistoftodos]{todonotes}
  \usepackage{breakcites}
  
  \usepackage{hhline}
  \usepackage{xcolor}
  \usepackage{colortbl}
  %\usepackage{asect}
  \usepackage{tocbibind}
  \usepackage{tocloft}
  \usepackage{acro}
  
  \input{annexes/abreviations}
  
  \usepackage[colorlinks]{hyperref}
  \hypersetup{
      colorlinks=true,
      linkcolor=blue,
      filecolor=magenta,      
      urlcolor=cyan,
      citecolor=violet
  }
  
  
  % ref packages
  \usepackage{nameref}
  % folowing  must be in this order
  \usepackage{varioref}
  \usepackage{hyperref}
  \usepackage{cleveref}
  \begin{document}
  \input{chapters/chap1.tex}
  \input{chapters/chap2.tex}
  \input{chapters/chap3.tex}
  \input{chapters/chap4.tex}
  
  \bibliographystyle{apalike}
  \bibliography{bibliography}
  
  
  
  \end{document}
  </code></pre>
  <p>in chapter 1</p>
  <pre><code>\chapter{title1}
  \label{chap1}
  
  here is defined the label{chap1}
  \section{section1}
  this is section1 
  \section{section1}
  this is section1 
  
  \section{section1}
  this is section1 
  </code></pre>
  <p>in chapter 3</p>
  <pre><code>\chapter{title3}
  \label{chap3}
  text reference Chapter \ref{chap1}
  </code></pre>
  <p>However, the reference shows the last section of chapter 1</p>
  <p><a href="https://i.stack.imgur.com/QUJaO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QUJaO.png" alt="chapter latex reference" /></a></p>
  <p>I am using texmaker quick build to compile the code. Here is the complete example on overleaf <a href="https://www.overleaf.com/read/rxkmhxcbcgqc" rel="nofollow noreferrer">https://www.overleaf.com/read/rxkmhxcbcgqc</a>
  we can also notice that referencing the first chapter does not work.</p>