add some checks for corrupted input files