fix unsafe code