Make index writing work, but it is still corrupt