Fix setting variables by making cached vars static