Added check for input timeout