Fix some problem in retrieving indexes.