Add distinct query for completion table to avoid duplicated records wrongly added before.