Fixed duplicate calls to a local reference providing a NULL result.