fixed several bugs when releasing protocol