Fix bug of database index