fixed npe on mac osx and linux