fixing race condition on loading youtube API