fixed while loop in handleRead to send proper packet number