fix macos compile bug
refactor