Fixed some mistakes accessing environment variables