flush stdin before asking for input

@wjwwood Please review and merge.