correctly update indexes on update