bugfixes for indexing