Fix false error detection on resource ctor and dtor