Fix a couple of bugs in key-comparator

and add two tests that fail without the fixes.
Merge pull request #17 from jafingerhut/master

Fix a couple of bugs in key-comparator