Fix resource preparation bug.

Auditors: pl