allocation of var_index corrected