move all unsafe fn into util