fix out of fds condition when indexing images.