added some index handling for api