added null guard in CachingHandler