trim invalid files