fixing cache write issue