Fix segfault on invalid implementation type.