Repaired error when friends was undefined