Added null check to each chat before incrementing.