Fixed exec exit condition [issue #30 and #32]