fixed a nasty issue when sh is bash 3.2 on Mac OS X