migrate old index mapping to new array type mapping

put the write stuff in its own try block