fixed caching tables bug