Fix copy error when getting tasks from the database