Added try/catch for null pointer from System.getenvt()