added cheeking of exit status