minor bug fix in document key event listeners