Fix some bugs:

    1) Handle differences is /bin/sh
    2) Handle differences in MAC dynamic lib Vs Linux shared lib
    3) Not confident that shared pointer stuff works 4.6 and onwards