Fixed issue with kernel directory deletion