fix bug where index was 1 off when selecting files when uploading