improved caching to check headers