fix issue #6

When there exceptions are thrown, reset level to 0