fixed infinite loop in prompt