BUG: Added fixes to unique in #4344 (fixes #2799)