Changed the place where it checks for task duplicity