Fix optional resources.

Correctly set the optional flag in the ResourceRate constructor and
preserve it when building the output rates array.