refine extension handling