Fix crash when env vars contain utf8 chars