Some fixes in index handling.