Fix overflows on device