Fixed table.adopt, so that it updates indexes