convert end_idx to int