Fix comparisons, add more tests