Fixed search of cache
Fixed log writing