fixed protocol codes bugs and finished testing protocols