Fix a crash on resetDevice