Fixed crash and warning regarding getenv()