Fixed connection management issues for protobuf