Fixed sleep issue in process loop