Fix handling of stdin