update index and some bug