fix following code review: remove global variable