switch to ensure_resource