MPU6050

So I am using an MPU6050 with an Teensy.
It works just fine. At least most of the time. Sometimes it gets stuck in the initiation code in setup():

  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B); // PWR_MGMT_1 register
  Wire.write(0);    // set to zero (wakes up the MPU-6050)
  Wire.endTransmission(true);

Any ideas what could cause this?

Thank you very much

Are you using interrupts?