Initialize "identifier map" and "counter" when flattening
Ensure all error constants are defined