BF: Fixed generate_protocol