add sleep, otherwise it got stuck quite often in the loop