fix: change global variable to local