Fix chkex and exception handling bugs.