Solve caching problem with static variables.