Preventing a total electricity blackout in South Africa