fix a few key management bugs