#53 cache layout lookups only if caching enabled, fix tests