modified Erlang lib for more friendly exception exit