fix merge + added some protocolmanager code