moved firebase callback into different if statement