fixed to support all platform and CLI mode