support mac and fix bug