Avoid KeyError from threading in OSX platform code