fixed the not blocking with only two iterations of the loop