changed file checking a little