Make sure model hierarchy is determined when needed and actually nullify reverse relations when model is destroyed