Fixed a crash on device reset