Fix function for Darwin