Fix the assumeunique constraint, fix some test cases