Major environment fixes