added option to debug the protocol