Fix potential scope leak issue in GameObject.js