add key extractor, fix test