Fix stdin processing