OS X: Make script more even robust