Fixing two issues with exit value checking