check exit status better