fix a rather obvious bug in environment selection