Small key handler bug fix