Fix equals conditioning and add tests for it.