Fix some metadata issues.

- Use metadata property instead of getMetadata() function so that metadata will be available in bundles.
- Account for missing metadata files in bower (regression).
- Account for missing app-level context.metadata array when an error occurs.