Fixed logic bug on exception