fixed caching/logging/error handling