Get environment correctly