input check in infinite loop