fixed status check for non-zero return code