Revert "fix key encoding regression"

This reverts commit 9aaacb9b5708ecd18fb802fe9e9c6d12245786fe.