fix unique term cacluations