Fix baseUrl detection