Doesn't this assume the function exist? It's in the else clause. Shouldn't that be a else of the macosx part.