move `if response_block` out of while loop

Re: #316