fix read polling by putting the buffer prepare in a loop