Small improvements in protocol handling