make sure object is actually created before attempting to insert in
auditlog. fixes exception mentioned in bugzilla 9472.