fix copying of env vars