Index.WriteIndex throws C# exceptions

See #1