Fix file extension detection