Fixed Firebase functionality