clean up some dead stores and some defensive coding for NULLs
test the correct obj for NULL and add some release logging for exceptional conditions