fixing empty variable when using cache