Added some more verifications in order to avoid completely indexing random files.