Fix IE10/11 problems (close #318), plus IE8 problems. Fix close modal by ESC key that was broken.