Remove debug code.
Fix stupid bugs in KV class.