added ensure index hook