Fixed env problem with apply-env
Fixed merge of if-conditionals