fixed infinite loop with cin