Possibly working, at least not segfaulting, nasty hack for index.