fixes for bug with dead code and exception handlers