fix the looping bug in recv reading