WIP: more protection against bad keys