save+restore ID counter; fix buglet introduced with ID's when saving region state