Fix unit test sometimes failing because of the modification of Unsafe