Preserve environmental variables
Fix static linkage flags usage