Add some protocol validation to avoid panics