Null check team rows before attempting to replace