added fixes and hacks to improve caching with memcached