Fixed some broken tests.
Improved pair checking.