correcting codes by generator