Fix bug when theres an unfinished diagnostic