fix optional protocol handling