fixed various processing invalid files issues