checking exit status