Arduino Uno Strucks Randomly

The example in the library is working fine with the current setup (I dont think i checked it long enough to notice freezing, will do that now).
so i think hardware may not be the problem.

Difference between example and working code is the following lines in the setup

    // join I2C bus (I2Cdev library doesn't do this automatically)
    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
        Wire.begin();
        Wire.setClock(400000); // 400kHz I2C clock. Comment this line if having compilation difficulties
    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
        Fastwire::setup(400, true);
    #endif