make the script work on OS X

fixes #687