fix ahead detection