Fixed permission issues and improved caching