utils: properly adjust array in remove actions