better index handling