copied from index-list (commit 11b1c28)