fixed problem with document.activeElement