Fix some problems for mac