fixed stack overflow relating to idle promise