Maybe fixed global variable issue.