some refactoring regarding protocol fixing