Fix linking issues with module variables in global scope