bug fix for indexing.