fix bus error on mac