Fix for shflags and getopt under OS X
merge