Protect against key decode errors

Edited by Frank Sauerburger