remove usage of to_mut_unsafe_ptr