better exit status checking in auto scripts