fixes for mac, and windows static linking