Fixed deadlock on exception