fix table iteration bug

There have a long term bug on table iteration