ensure_resource instead of !defined