[backport]  correct save/remove behiour of enum indexes