Added check for stdin