Guard against segfault.
Fix segfault