fix cache middleware