add debug statements for segfault location
change reference rename to reflect new api
remove debug flags
Merge branch 'refsegfault'