do not allow infinite loop if there is nothing coming from server