modify util to adapt to different platforms