bug fix and support empty protocol