problem with function called before async done