added more segfault checks.