better protocol handling