minor fixes to cache indexing
fix session and undefined index