Implement interface to set KeyName in KeyLocator and several bug fixes.