Improve checking exit status