M5Stack Fire reset

I am playing with a M5Stack Fire I received for Christmas. The script I have written involves a using NTPClient.h and WiFiUdp.h to get the date and time from an NTP server. It connects to the internet using WiFi.h. Everything works fine except for one issue:

  1. Mostly the device fails to connect to the WiFi on its first attempt, a hard reset almost always fixes this and it connects. How can I make it connect first time?