error in 2 files fix

added some code so that it can handle a race condition if it happens in
lines from two different files