Port to OSX (10.6+). This commit will most likely break Linux :)