Fixed a compiler issue in OSX.

Introduces a temporary variable that fixes compilation in OSX.