protecting from segfaults