It appears the loop to drop templates of obsolete blocks was unnecessary as it can be replaced with re-initializing the array to an empty value.