Fix runtime error on OSX