fix rerr generation