Arduino MKR 1000 gives me wrong MAC Address

I have tested this on multiple Arduino MKR 1000s bought from Arduino.cc. They all give me the Mac address d0-02-00-20-9c-7f, which is NOT the Mac address printed on the board. What am I doing wrong? Here's my code.

#include <SPI.h>
#include <WiFi101.h>

char ssid[]="MySSID";
char pass[]="mypassword";
int status=WL_IDLE_STATUS;
int pushbutton=2;
int led=6;
String arduinoid;
int buttonstate=0;
int lastbuttonpush=-1;
int curtime=0;
int lightstate=0;
int lighttimer=-1;
int serverlisten=0;
int servererrorcountdown=0;
int lastconntime;

// the setup routine runs once when you press reset:

char hibyte(byte thebyte)
{
int myval=(int)thebyte/16;
if (myval<10)
return (char) (myval+(int)'0'); //48 is the ascii value of 0
else
return (char) ((myval-10)+(int)'a'); //97 is the ascii value of a
}

char lobyte(byte thebyte)
{
int myval=(int)thebyte%16;
if (myval<10)
return (char) (myval+(int)'0');
else
return (char) ((myval-10)+(int)'a'); //97 is the ascii value of a
}

void setup() {
char c;
String readstr="";
byte tempaddr[7];
char throwaway[7]="";
int x=0;
arduinoid="";
WiFiClient client;
WiFi.macAddress(tempaddr);
tempaddr[6]='\0';
for (x=5; x>-1; x--)
{
if (x<5)
arduinoid=arduinoid+"-";
arduinoid=arduinoid+hibyte(tempaddr[x]);
arduinoid=arduinoid+lobyte(tempaddr[x]);
}
.
.
.
Other irrelevant stuff.

arduinoid always returns me d0-02-00-20-9c-7f. It should return me fbf005.

Well, I found the problem. The WiFi status actually has to be WL_CONNECTED before it can read its own Mac address. Once I moved the code to AFTER the connection with WiFi was established, it worked fine.