 {
   static WiFiEventHandler gotIpEventHandler, apConnectedEventHandler,
       disconnectedEventHandler;
-  gotIpEventHandler = WiFi.onStationModeGotIP(onSTAGotIP);
-  apConnectedEventHandler = WiFi.onSoftAPModeStationConnected(onAPConnected);
-  disconnectedEventHandler = WiFi.onStationModeDisconnected(onSTADisconnected);
+  gotIpEventHandler = WiFi.onStationModeGotIP(&onSTAGotIP);
+  apConnectedEventHandler = WiFi.onSoftAPModeStationConnected(&onAPConnected);
+  disconnectedEventHandler = WiFi.onStationModeDisconnected(&onSTADisconnected);
 
   // Set WiFi hostname
   if (os_strlen(cfg.hostname) == 0)

 *
 * @param event WiFiEventStationModeGotIP Event
 */
void onSTAGotIP(WiFiEventStationModeGotIP event)
{

#ifdef DEBUG

 *
 * @param event WiFiEventStationModeDisconnected Event
 */
void onSTADisconnected(const WiFiEventStationModeDisconnected &event)
{
  DEBUGLOG("WiFi connection (%s) dropped.\n", event.ssid.c_str());
  DEBUGLOG("Reason: %d\n", event.reason);
