Small js fix (remove global variable)