make input handling more sane and allow reading from stdin