fixed and added tests for uniqueness check