Fix caching bug

Ensures last-changed is set in HTTP headers from API but check that the internal cache actually exists and making it when it doesn't.