fixed indexd.c::add_document()