Fix the idle loop using 100% cpu to do nothing