added exitCode()==0 checks in two places.