Handle heteregeneous files more gracefully