fix console environment detection order.