Make rc installation script more robust