Added `maxnum` option to limit the number of elements in tables.
Optimized processing of tables with numeric indexes.
Fixed an issue with mixed tables that may be missing keys.

Earlier optimization depended on incorrect assumption that `next` can be
started by using #t, which is not the case.