Fix bug where env host was set too late.