Fix #519 environment variable problem