Error correction for internal storage