Refix duplicate results bug

Same fix as in https://github.com/wtud/tsap/pull/131.