Fix syntax errors in input loop