Minor bug fixes: Mem leak in application of s_idx_arr