Fix backwards set comparison; add tests