Is it the call to looponce() or the second call to stopwaiting() that's causing the issue?