Fix resource preparation bug introduced by previous fix.