Changed order of the ssl_mode check.