Fix computation of lws0.
Reset context only after an exception.