Fix some undeclared global variables