guard against segfaults