Fixed a random crash bug (undefined global)