Fix dependency issue and use stringstream