Since the inception of MSC over 80 years ago and through our last 25 years as a public company, our mission has stayed the same: to be the best industrial distributor in the world as measured by our four stakeholders.
And as a reminder, those goals are reaching 400 basis points of market share capture by the end of fiscal 2023 and returning return on invested capital into the high teens by improving our operating expense-to-sales ratio, inclusive of a $90 million to $100 million gross cost takeout target.
We eliminated 110 positions, and we're adding 135 positions that are customer-facing and that will drive growth.
Second, while we all face supply chain disruptions and shortages, MSC's broad and deep product assortment, our multiple brand choices including exclusive brands, and our next-day delivery capabilities position us very well against the 70% of the market, made up of local and regional distributors.
We also expect a continued stream of structural cost work that is moving us toward the higher end of our $90 million to $100 million cost takeout range.
Before getting into the details, I'll start by addressing the obvious issue in our second quarter that impacted results, which is the inventory writedown on PPE of roughly $30 million.
Overall sales were down 1.5% for the quarter.
Recall that a 200 basis point spread was our target for our fiscal fourth quarter.
Safety and janitorial, on the other hand, were down roughly 20% against last year's PPE surge.
Due to the PPE writedown, our GAAP gross margin was 38.1%.
But excluding that writedown, adjusted gross margin was 42%, down just 10 basis points versus the prior year and up 10 basis points sequentially from the first quarter.
Our second-quarter sales were $774 million, or $12.7 million, on an average daily sales basis, both a decline of 1.5% versus the same quarter last year.
Our second-quarter gross margin was 38.1%, a decline of 400 basis points compared to the second quarter of last year.
As Erik mentioned, this was primarily the direct result of the roughly $30 million PPE writedown we recorded during the quarter, which was primarily related to masks.
Excluding this writedown, our second-quarter gross margin was 42%, a 10 basis point decline from the prior year and a 10 basis point increase sequentially from our first quarter.
Operating expenses in the second quarter were $245.1 million, or 31.7% of sales, versus $251.4 million, or 32% of sales in the prior year.
This includes about $700,000 of legal costs associated with the nitrile glove prepayments we impaired in the first quarter.
Excluding these costs, operating expenses as a percent of sales was 31.6%, a 40 basis point improvement from the prior year in which there were no operating expense adjustments.
We incurred approximately $21.6 million of restructuring costs, primarily related to the move to virtual customer care hubs and a review of our operating model, both related to Mission Critical.
In Q2 of last year, we incurred $1.9 million of restructuring charges, and that was primarily related to consulting costs.
All of that led to operating margin on a GAAP basis of 3.6%, but that was significantly influenced by the PPE writedown and the restructuring charges related to the virtual customer care hubs.
Excluding this writedown, as well as the restructuring and other related costs, our adjusted operating margin was 10.4%, up 30 basis points from the prior year due to our progress on Mission Critical and despite lower sales.
GAAP earnings per share were $0.32.
Adjusted for the inventory writedown, as well as restructuring, and other charges, adjusted earnings per share were $1.03.
Our free cash flow was $4 million for the second quarter as compared to $58 million in the prior year.
As of the end of fiscal Q2, we were carrying $533 million of inventory, up $12 million from last quarter.
This is net of the $30 million inventory writedown during the quarter.
We now expect capex for the fiscal year of approximately $50 million to $60 million.
We still expect our cash flow conversion or operating cash flow divided by net income to be above 100% for fiscal '21.
As we mentioned on our last call, we increased our debt to fund the $195 million special dividend paid in December.
Our total debt as of the end of the second quarter was $684 million, comprised primarily of a $115 million balance on our revolving credit facility, about $200 million on our uncommitted facilities, $20 million of short-term fixed rate borrowings, and $345 million of long-term fixed rate borrowings.
Cash and cash equivalents were $20 million, resulting in net debt of $664 million at the end of the quarter.
On Slide 8, you can see our original program goals of $90 million to $100 million of cost takeout through fiscal '23, and that's versus fiscal '19.
On our last call, we shared that we had taken out $8 million of gross savings and invested roughly $2 million to $3 million in the first quarter.
During our fiscal second quarter, we achieved additional gross savings of $9 million, bringing our cumulative savings for fiscal '21 to $17 million against our goal of $25 million by the end of this year.
We also invested roughly $5 million in Q2, bringing our total investments to $7 million to $8 million, which compares to our full-year target of $15 million.
The most significant initiative during the quarter was, of course, our move to virtual customer care hubs, including the closure of 73 sales branches.
The gross savings related to that move are expected to be between $7 million and $9 million in fiscal 2021 and reach an annualized level of approximately $15 million to $18 million starting in fiscal 2022.

Summary:
Our second-quarter sales were $774 million, or $12.7 million, on an average daily sales basis, both a decline of 1.5% versus the same quarter last year.
GAAP earnings per share were $0.32.
Adjusted for the inventory writedown, as well as restructuring, and other charges, adjusted earnings per share were $1.03.