fix compatibility issue between OSX and Linux