fixing script so it also works on MacOSX