Fix input reading with larger buffer sizes