A couple bug fixes to prevent null exceptions and make objects die with dependency