replaced index update by remove/insert