exit code handling fix