fix extension logic