Fix IE8 variable hoisting of apply function in  if/else.