Fix module variables scope problem