Fix some exception bugs.