Maintenance and repair of oil and gas wells