Remerge latest fixes from master into development

Some fixes including a fix to curl under clang were applied to master but not development.