declare index as local var