add some code to fit for mac os x