RAZ-3309: Exporting metadata for all assets throws errors
- Fixed issue with variable scoping