defensive codings to get rid of the segfaults
merge conflicts