fix again using non-blocking with while