Fix BASE_URL detection