clean bad index maintenance code