Corrected NaN problems while dumping the state