more robust exit status