fix table indices