Fix environment bug