Fix environment problems