revert from keeping last index to length